shapiroWilkTestDialog <- function(){
	initializeDialog(title=gettextRcmdr("Shapiro-Wilk Test of Normality"))
	variableBox <- variableListBox(top, Numeric(), title=gettextRcmdr("Variable (pick one)"))
	groupsBox(recall = summaryNumericDialog, label = gettext("Groups by: ", domain="R-RcmdrPlugin.TeachingExtras"), 
			initialLabel = gettext("Groups by ", domain="R-RcmdrPlugin.TeachingExtras"))
	onOK <- function(){
		var <- getSelection(variableBox)
		if (length(var) == 0) {
			errorCondition(recall=ShapiroTest, message=gettextRcmdr("You must select a variable."))
			return()
		}
		if (.groups != FALSE) {
			grps <- paste(.activeDataSet, "$", .groups, sep = "")
			doItAndPrint(paste("tapply(", ActiveDataSet(), "$", var, ", ", grps, ", shapiro.test)", sep=""))
			
		}
		else {
			doItAndPrint(paste("shapiro.test(",ActiveDataSet(), "$", var, ")", sep=""))
		}
		closeDialog()
		tkfocus(CommanderWindow())
	}
	OKCancelHelp(helpSubject="shapiro.test")
	tkgrid(getFrame(variableBox), sticky="nw")
	tkgrid(groupsFrame, sticky = "w")
	tkgrid(buttonsFrame, sticky="w")
	dialogSuffix(rows=2, columns=1)
}
